$(function () {
    findCuisineAll();
});

function findCuisineAll() {
    let data = null;
    $.ajax({
        url: '/back/cuisine/findAll',
        data: {},
        type: 'get',
        dataType: 'json',
        success: function (res) {
            setCuisineData(res.data);
            data = res.data;
            console.log(data);
        }
    });
    return data;
}

function setCuisineData(data) {
    layui.use(['form'],
        function () {
            let form = layui.form;
            let html = '';
            for (let i = 0; i < data.length; i++) {
                html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
            }
            $("#cuisine").html(html);
            form.render();//重新渲染


        });
}
